<template>
  <div class="logisticsCompanyDetail">
    <zyInfoPanel title="物流公司查询" :showUnfoldButton="false" class="logisticsCompanyItem">
      <zyInfoPanelDetail :info="companyInfo" cellNum="4"></zyInfoPanelDetail>
    </zyInfoPanel>
    <zyInfoPanel title="企业业务信息" :showUnfoldButton="false" class="logisticsCompanyItem">
      <zyInfoPanelDetail :info="businessInfo" cellNum="4"></zyInfoPanelDetail>
    </zyInfoPanel>
    <zyInfoPanel title="物流公司查询" :showUnfoldButton="false" class="logisticsCompanyItem">
      <div class="imgArea">
        <div class="licenseImg">
          <div class="imgTitle">营业执照(副本)：</div>
          <div class="imgContent">
            <zy-image v-model="license_img" class="img" v-if="license_img" readonly></zy-image>
          </div>
        </div>
      </div>
    </zyInfoPanel>
  </div>
</template>

<script>
	export default {
		name: "CLogisticsCompanyDetail",
		props: {},
		data() {
			return {
				company_id: '',
				companyInfo: [
					{
						name: "企业名称：",
						val: "",
						code: 'company_name'
					},
					{
						name: "统一社会信用代码：",
						val: "",
						code: 'organization_code'
					},
					{
						name: "经营地址：",
						val: "",
						code: 'company_address'
					},
					{
						name: "经营期限：",
						val: "",
						code: 'buiss_time'
					},
					{
						name: "法人名称：",
						val: "",
						code: 'legal_person'
					},
					{
						name: "联系方式：",
						val: "",
						code: 'legal_phone'
					},
					{
						name: "企业类型：",
						val: "",
						code: 'type_desc'
					},
				],
				businessInfo: [
					{
						name: "     负责人：",
						val: "",
						code: 'control_man'
					},
					{
						name: "联系方式：",
						val: "",
						code: 'control_phone'
					},
					{
						name: "物流路线：",
						val: "",
						code: 'tansline_remark'
					},
				],
				license_img: ''
			};
		},
		computed: {},
		watch: {},
		components: {},
		methods: {
			getData() {
				this.$axios.post(this.$api.c_getCooperCompanyInfo, {
					company_id: this.company_id
				}).then(res => {
					let {code, msg} = res;
					let data = res.data.info;
					if (code == 200) {
						this.companyInfo = this.companyInfo.filter(item=>{
							if(item.code === 'buiss_time'){
								item.val = `${data.buiss_time_start_desc} - ${data.buiss_time_end_desc}`;
              }else{
								item.val = data[item.code];
              }
							return item
						});
						this.businessInfo = this.businessInfo.filter(item=>{
							item.val = data[item.code];
							return item
						});
						this.license_img = data.license_img;
					} else {
						this.$message.error(msg);
					}
				}).catch(ret => {
					this.$message.error(ret.msg || '服务繁忙，请稍后再试');
				});
			},
		},
		mounted() {
			this.company_id = this.$route.query.company_id;
			this.getData();
		},
		created() {
		}
	}
</script>

<style scoped lang="less" src="@/style/cooperate/logisticsCompany/logisticsCompanyDetail/index.less">

</style>
